package com.eastcom.bm.dao.impl;

import java.util.ArrayList;
import java.util.List;

import com.eastcom.bm.atom.Atom_ActionJMSNotice;
import com.eastcom.bm.dao.IJMSNoticeDao;
import com.eastcom.common.db.JDBCTemplate;
import com.eastcom.common.db.ResultData;

public class JMSNoticeDao implements IJMSNoticeDao {

	public List<Atom_ActionJMSNotice> getAllJMSNotice() throws Exception {
		try{
			List<Atom_ActionJMSNotice> results=new ArrayList<Atom_ActionJMSNotice>();
			
			ResultData rd=JDBCTemplate.executeSQLQuery("select * from qa_jmsnotice", JDBCTemplate.PROPAGATION_NEVER, false, false);
			while(rd.next()){
				Atom_ActionJMSNotice jmsNotice=new Atom_ActionJMSNotice();
				
				jmsNotice.setUuid(rd.getString("UUID"));
				jmsNotice.setName(rd.getString("NAME"));
				jmsNotice.setCName(rd.getString("CNAME"));
				jmsNotice.setContextFactory(rd.getString("CONTEXT_FACTORY"));
				jmsNotice.setProviderURL(rd.getString("PROVIDER_URL"));
				jmsNotice.setSecurityAuthentication(rd.getString("SECURITY_AUTHENTICATION"));
				jmsNotice.setSecurityCredentials(rd.getString("SECURITY_CREDENTIALS"));
				jmsNotice.setSecurityPrincipal(rd.getString("SECURITY_PRINCIPAL"));
				jmsNotice.setDestinationFactory(rd.getString("DESTINATION_FACTORY"));
				jmsNotice.setDestinationName(rd.getString("DESTINATION_NAME"));
				jmsNotice.setDestinationType(rd.getString("DESTINATION_TYPE"));
				jmsNotice.setSubscribeDurable(rd.getString("SUBSCRIBE_DURABLE"));
				jmsNotice.setClientID(rd.getString("CLIENT_ID"));
				
				results.add(jmsNotice);
			}

			return results;
		}
		catch(Exception e){
			throw e;
		}
	}

}
